<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'wage_list2.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css" href="css/table.css">
<script language="javascript" type="text/javascript"
	src="<%=basePath%>My97DatePicker/WdatePicker.js"></script>
<script>
	var req;
	window.onload = function() {//页面加载时的函数
	}

	function Change_Select() {//当第一个下拉框的选项发生改变时调用该函数
		var province = document.getElementById('province').value;
		var url = "select?dept_id=" + escape(province);
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		}
		if (req) {
			req.open("GET", url, true);
			//指定回调函数为callback
			req.onreadystatechange = callback;
			req.send(null);
		}
	}
	//回调函数
	function callback() {
		if (req.readyState == 4) {
			if (req.status == 200) {
				parseMessage();//解析XML文档
			} else {
				alert("不能得到描述信息:" + req.statusText);
			}
		}
	}
	//解析返回xml的方法
	function parseMessage() {
		var xmlDoc = req.responseXML.documentElement;//获得返回的XML文档
		var xSel = xmlDoc.getElementsByTagName('select');
		//获得XML文档中的所有<select>标记
		var select_root = document.getElementById('city');
		//获得网页中的第二个下拉框
		select_root.options.length = 0;
		//每次获得新的数据的时候先把每二个下拉框架的长度清0

		for ( var i = 0; i < xSel.length; i++) {
			var xValue = xSel[i].childNodes[0].firstChild.nodeValue;
			//获得每个<select>标记中的第一个标记的值,也就是<value>标记的值
			var xText = xSel[i].childNodes[1].firstChild.nodeValue;
			//获得每个<select>标记中的第二个标记的值,也就是<text>标记的值

			var option = new Option(xText, xValue);
			//根据每组value和text标记的值创建一个option对象

			try {
				select_root.add(option);//将option对象添加到第二个下拉框中
			} catch (e) {
			}
		}
	}
</script>

</head>
<body>
	<form action="wageAction!searchWage.action" method="post" name="search">
		<table cellpadding="0" cellspacing="0" id="mytable">
			<caption>按条件查询</caption>
			<tr>
				<td>月份<input name="wage.wage_month"
					onclick="WdatePicker({dateFmt:'yyyy-MM'})" type="text" />
				</td>
				<td colspan="2" align="center"><input type="submit" value="提交">
				</td>
		</table>
	</form>
	<table>
		<caption>工资列表</caption>
		<thead>
			<tr>
				<th>员工ID</th>
				<th>员工姓名</th>
				<th>基本工资</th>
				<th>应工作天数</th>
				<th>实际工作天数</th>
				<th>津贴内容</th>
				<th>津贴工资</th>
				<th>实际工资</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody id="tab">

			<s:iterator value="wageList" var="wage">
				<tr>
					<td><s:property value="#wage.wage_emp_id" /></td>
					<td><s:property value="#wage.wage_emp_name" /></td>
					<td><s:property value="#wage.wage_base" /></td>
					<td><s:property value="#wage.wage_should_days" /></td>
					<td><s:property value="#wage.wage_work_days" /></td>
					<td><s:property value="#wage.wage_subsidy_detail"
							escape="false" /></td>
					<td><s:property value="#wage.wage_subsidy_sum" /></td>
					<td><s:property value="#wage.wage_real" /></td>
					<td><a
						href="wageAction!delWage.action?wage.wage_id=<s:property value="#wage.wage_id" />">[删除]</a>
				</tr>
			</s:iterator>


		</tbody>
	</table>
	<script type="text/javascript">
	<!--
		var Ptr = document.getElementById("tab").getElementsByTagName("tr");
		function $() {
			for (i = 1; i < Ptr.length + 1; i++) {
				Ptr[i - 1].style.backgroundColor = (i % 2 > 0) ? "#fff"
						: "#eee";
			}
		}
		window.onload = $;
		for ( var i = 0; i < Ptr.length; i++) {
			Ptr[i].onmouseover = function() {
				this.tmpClass = this.className;
				this.style.backgroundColor = "#ccc";

			};
			Ptr[i].onmouseout = function() {
				for (i = 1; i < Ptr.length + 1; i++) {
					Ptr[i - 1].style.backgroundColor = (i % 2 > 0) ? "#eee"
							: "#fff";
				}
			}
		}
	//-->
	</script>

</body>
</html>